<%@ Page Language="C#" AutoEventWireup="true" CodeFile="xuphat_vp.aspx.cs" Inherits="Telerik.GridExamplesCSharp.DataEditing.AllEditableColumns.thongtinkhac_xuphat_vp" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Untitled Page</title>
     <style type="text/css">
        .MyImageButton
        {
           cursor: hand;
        }
        .EditFormHeader td
        {
            font-size: 14px;
            padding: 4px !important;
            color: #0066cc;
        }
        </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        
            <p id="divMsgs" runat="server">
        <asp:Label ID="Label1" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#FF8080"></asp:Label>
        <asp:Label ID="Label2" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#00C000"></asp:Label>
            </p>
            
         <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

            <script type="text/javascript">
            function RowDblClick(sender, eventArgs)
            {
              sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            }
            </script>

        </telerik:RadCodeBlock>
        <!-- load ajax-->
         <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid_Xlsp">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid_XLsp" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="divMsgs" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
        </telerik:RadAjaxManager>
        <!-- end-->
        
        
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" 
            BackColor="#99FF66" Skin="WebBlue" />
        <telerik:RadGrid ID="RadGrid_XLsp" runat="server" AllowPaging="True" 
            AllowSorting="True" CellSpacing="0" DataSourceID="SqlDataSource_sp1" 
            GridLines="None" AllowAutomaticDeletes="True" AutoGenerateColumns="False"
            AllowAutomaticInserts="True" AllowAutomaticUpdates="True" OnItemUpdated="RadGrid_XLsp_ItemUpdated"
             
           OnItemInserted="RadGrid_XLsp_ItemInserted" OnDataBound="RadGrid_XLsp_DataBound" Skin="Telerik">
                <HeaderContextMenu></HeaderContextMenu>

                <MasterTableView AutoGenerateColumns="False" DataKeyNames="Mavipham" 
                                DataSourceID="SqlDataSource_sp1" CommandItemDisplay="Top">
                                
                <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>

                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>

    <Columns>
    <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                        <ItemStyle CssClass="MyImageButton" />
                    </telerik:GridEditCommandColumn>
                    
        <telerik:GridBoundColumn DataField="Mavipham" DataType="System.Int32"  Visible="false"
            FilterControlAltText="Filter Mavipham column" HeaderText="Mavipham" ReadOnly="True" 
            SortExpression="Mavipham" UniqueName="Mavipham">
        </telerik:GridBoundColumn>
        
           <telerik:GridTemplateColumn HeaderText="STT">
                       <ItemTemplate>
                        <asp:Label runat="server" ID="lblSTT" Text='<%#i++%>'></asp:Label>
                       </ItemTemplate>
           </telerik:GridTemplateColumn>
        
       
        
        <telerik:GridDropDownColumn DataField="Madnghiep" DataSourceID="sp_dn"
                        HeaderText="Doanhnghiep" ListTextField="TenDN" ListValueField="Madnghiep"
                        UniqueName="Madnghiep" ColumnEditorID="GridDropDownColumnEditor1">
        </telerik:GridDropDownColumn>
        
        <telerik:GridBoundColumn DataField="SoQDXP" 
            FilterControlAltText="Filter SoQDXP column" HeaderText="So quyet dinh xu phat" 
            SortExpression="SoQDXP" UniqueName="SoQDXP">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="NgayraQD" 
            FilterControlAltText="Filter NgayraQD column" HeaderText="Ngay ra quyet dinh" SortExpression="NgayraQD" 
            UniqueName="NgayraQD">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Tenvipham" 
            FilterControlAltText="Filter Tenvipham column" HeaderText="Ten vi pham" 
            SortExpression="Tenvipham" UniqueName="Tenvipham">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Khoanvipham" 
            FilterControlAltText="Filter Khoanvipham column" HeaderText="Khoan vi pham" 
            SortExpression="Khoanvipham" UniqueName="Khoanvipham">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Dieuvipham" 
            FilterControlAltText="Filter Dieuvipham column" HeaderText="Dieu vi pham" 
            SortExpression="Dieuvipham" UniqueName="Dieuvipham">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Nghidinhvipham" 
            FilterControlAltText="Filter Nghidinhvipham column" HeaderText="Nghi dinh vi pham" 
            SortExpression="Nghidinhvipham" UniqueName="Nghidinhvipham">
        </telerik:GridBoundColumn>
         <telerik:GridBoundColumn DataField="Ghichu" 
            FilterControlAltText="Filter Ghichu column" HeaderText="Ghi chu" 
            SortExpression="Ghichu" UniqueName="Ghichu">
        </telerik:GridBoundColumn>
         <telerik:GridBoundColumn DataField="Sotiennopphat" 
            FilterControlAltText="Filter Sotiennopphat column" HeaderText="So tien nop phat" 
            SortExpression="Sotiennopphat" UniqueName="Sotiennopphat">
        </telerik:GridBoundColumn>
        
        <telerik:GridButtonColumn ConfirmText="Delete this sanpham?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                        UniqueName="DeleteColumn">
                        <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                    </telerik:GridButtonColumn>
    </Columns>

            <EditFormSettings EditFormType="Template" ColumnNumber="2" CaptionDataField="Madnghiep" CaptionFormatString="Edit properties of Product {0}" InsertCaption="New Sanpham">
            
<EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column"></EditColumn>
            
                <FormTemplate>
                
                    <table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="0" rules="none"
                        style="border-collapse: collapse; background: white;" >
                        <tr class="EditFormHeader">
                            <td colspan="2" style="font-size: small">
                                <b>Nhap thong tin: XU PHAT HANH CHANH</b>
                            </td>
                        </tr>                      
                        
                             <tr>
                               <td>
                                <table id="Table3" cellspacing="1" cellpadding="1" width="100%" border="0" class="module">
                               <tr>
    <td>Doanh nghiep:</td>
    <td>
    <asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind("Madnghiep") %>'
DataTextField="TenDN" TabIndex="7" DataValueField="Madnghiep" DataSourceID="sp_dn" AppendDataBoundItems="True">
    <asp:ListItem Selected="True" Text="Select" Value=""></asp:ListItem>
    </asp:DropDownList>
    </td>
</tr>
<tr>
    <td>So quyet dinh xu phat:</td>
    <td><asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("SoQDXP") %>'></asp:TextBox></td>
</tr>
<tr>
    <td>Ngay ky quyet dinh:</td>
    <td>
    
    <telerik:RadDatePicker ID="RadDatePicker1" runat="server" Skin="Hay">
<Calendar ID="Calendar1" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" 
        ViewSelectorText="x" Skin="Hay" runat="server"></Calendar>

<DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton>
<DateInput ID="DateInput1" DisplayDateFormat="M/d/yyyy" DateFormat="M/d/yyyy" runat="server"></DateInput>
        </telerik:RadDatePicker>
    </td>
</tr>
<tr>
    <td>Nguoi ky quyet dinh:</td>
    <td>
        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></td>
</tr>
<tr>
    <td>Khoan vi pham:</td>
    <td><telerik:RadComboBox ID="cb_kvp" runat="server" Skin="Hay">
                <Items>
                    <telerik:RadComboBoxItem runat="server" Text="O nhiem nuoc" 
                        Value="O nhiem nuoc" />
                    <telerik:RadComboBoxItem runat="server" Text="Nuoc ban" 
                        Value="Nuoc ban" />
                    <telerik:RadComboBoxItem runat="server" Text="Khi ban" Value="Khi ban" />
                    <telerik:RadComboBoxItem runat="server" Text="Nuoc do" 
                        Value="Nuoc do" />
                </Items>
            </telerik:RadComboBox> 
    </td>
</tr>
<tr>
    <td>Dieu vi pham:</td>
    <td><telerik:RadComboBox ID="RadComboBox1" runat="server" Skin="Hay">
                <Items>
                    <telerik:RadComboBoxItem runat="server" Text="Dieu 108" 
                        Value="Dieu 108" />
                    <telerik:RadComboBoxItem runat="server" Text="Dieu 101" 
                        Value="Dieu 101" />
                    <telerik:RadComboBoxItem runat="server" Text="Dieu 45" Value="Dieu 45" />
                    <telerik:RadComboBoxItem runat="server" Text="Dieu 10" Value="Dieu 10" />    
                </Items>
            </telerik:RadComboBox>
    </td>
</tr>
<tr>
    <td>Nghi dinh vi pham:</td>
    <td><telerik:RadComboBox ID="RadComboBox2" runat="server" Skin="Hay">
                <Items>
                    <telerik:RadComboBoxItem runat="server" Text="Nghi dinh I" 
                        Value="Nghi dinh I" />
                    <telerik:RadComboBoxItem runat="server" Text="Nghi dinh II" 
                        Value="Nghi dinh II" />
                    <telerik:RadComboBoxItem runat="server" Text="Nghi dinh III" Value="Nghi dinh III" />
                    <telerik:RadComboBoxItem runat="server" Text="Nghi dinh IV" Value="Nghi dinh IV" />    
                </Items>
            </telerik:RadComboBox>
    </td>
</tr>
<tr>
    <td>Ghi chu:</td>
    <td>
<telerik:RadEditor ID="RadEditor1" runat="server" Width="390px" Height="182px">
<Tools>
<telerik:EditorToolGroup Tag="MainToolbar">
<telerik:EditorSplitButton Name="Undo">
</telerik:EditorSplitButton>
<telerik:EditorSplitButton Name="Redo">
</telerik:EditorSplitButton>
<telerik:EditorTool Name="Cut" />
<telerik:EditorTool Name="Copy" />
<telerik:EditorTool Name="Paste" ShortCut="CTRL+V" />
</telerik:EditorToolGroup>
<telerik:EditorToolGroup Tag="Formatting">
<telerik:EditorTool Name="Bold" />
<telerik:EditorTool Name="Italic" />
<telerik:EditorTool Name="Underline" />
<telerik:EditorSeparator />
<telerik:EditorSplitButton Name="ForeColor">
</telerik:EditorSplitButton>
<telerik:EditorSplitButton Name="BackColor">
</telerik:EditorSplitButton>
<telerik:EditorSeparator />
<telerik:EditorDropDown Name="FontName">
</telerik:EditorDropDown>
<telerik:EditorDropDown Name="RealFontSize">
</telerik:EditorDropDown>
</telerik:EditorToolGroup>
</Tools>
<Content></Content>        
</telerik:RadEditor>
    </td>
</tr>
<tr>
    <td>So tien nop phat:</td>
    <td>
        <asp:TextBox ID="TextBox3" runat="server" Text='<%#Bind("Sotiennopphat") %>'></asp:TextBox></td>
</tr>
<tr>
    <td>File dinh kem:</td>
    <td><telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" Height="19px" 
           Skin="Telerik" Width="159px">
       </telerik:RadAsyncUpload>
    </td>
</tr>
                                </table>
                            </td>
                    
                            <td>
                            
                            </td>
                            </tr>
                           
                        <tr>
                            <td align="right" colspan="2">
                                 <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                    runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                </asp:Button>&nbsp;
                                        <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                        CommandName="Cancel"></asp:Button>
                                  
                                 
                            </td>
                        </tr>
                    </table>
                </FormTemplate>
            </EditFormSettings>
           </MasterTableView>
           <ClientSettings EnableRowHoverStyle="true">
               <Selecting AllowRowSelect="True" />
               <ClientEvents OnRowDblClick="RowDblClick" />
           </ClientSettings>


<FilterMenu EnableImageSprites="False"></FilterMenu>
        </telerik:RadGrid>
        <asp:SqlDataSource ID="SqlDataSource_sp1" runat="server"
          ConnectionString="<%$ ConnectionStrings:QLMTConnectionString %>" ProviderName="System.Data.SqlClient"
          SelectCommand="SELECT * from Xuphatvipham where Madnghiep=@Madnghiep"
           DeleteCommand="DELETE FROM [Xuphatvipham] WHERE [Mavipham] = @original_Mavipham"
           InsertCommand="INSERT INTO Xuphatvipham(Madnghiep, SoQDXP,NgayraQD,Tenvipham,Khoanvipham,Dieuvipham,Nghidinhvipham,Ghichu,Sotiennopphat,Filedinhkem) VALUES (@Madnghiep,@SoQDXP,@NgayraQD,@Tenvipham,@Khoanvipham, @Dieuvipham, @Nghidinhvipham, @Ghichu, @Sotiennopphat, @Filedinhkem)"
           UpdateCommand="UPDATE [Xuphatvipham] SET [Madnghiep] = @Madnghiep, [SoQDXP] = @SoQDXP, [NgayraQD] = @NgayraQD, [Tenvipham] = @Tenvipham,[Khoanvipham]=@Khoanvipham,[Dieuvipham]=@Dieuvipham,[Nghidinhvipham]=@Nghidinhvipham,[Ghichu]=@Ghichu,[Sotiennopphat]=@Sotiennopphat,[Filedinhkem]=@Filedinhkem WHERE [Mavipham] = @original_Mavipham"
           
          OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues">
         
          <SelectParameters>
        <asp:QueryStringParameter Name="Madnghiep" QueryStringField="_iddn"  ConvertEmptyStringToNull="true"/>
     </SelectParameters> 
          <DeleteParameters>
               <asp:Parameter Name="original_Mavipham" Type="Int32" />
           </DeleteParameters>
           <UpdateParameters>
               <asp:Parameter Name="Madnghiep" Type="Int32" />
               <asp:Parameter Name="SoQDXP" Type="String" />
               <asp:Parameter Name="NgayraQD" Type="String" />
               <asp:Parameter Name="Tenvipham" Type="String" />
               <asp:Parameter Name="Khoanvipham" Type="String" />
               <asp:Parameter Name="Dieuvipham" Type="String" />
               <asp:Parameter Name="Nghidinhvipham" Type="String" />
               <asp:Parameter Name="Ghichu" Type="String" />
               <asp:Parameter Name="Sotiennopphat" Type="String" />
               <asp:Parameter Name="Filedinhkem" Type="String" />
               
               <asp:Parameter Name="original_Mavipham" Type="Int32" />
               
               
           </UpdateParameters>
           <InsertParameters>                
               
               <asp:Parameter Name="Madnghiep" Type="Int32" />
                <asp:Parameter Name="SoQDXP" Type="String" />
               <asp:Parameter Name="NgayraQD" Type="String" />
               <asp:Parameter Name="Tenvipham" Type="String" />
               <asp:Parameter Name="Khoanvipham" Type="String" />
               <asp:Parameter Name="Dieuvipham" Type="String" />
               <asp:Parameter Name="Nghidinhvipham" Type="String" />
               <asp:Parameter Name="Ghichu" Type="String" />
               <asp:Parameter Name="Sotiennopphat" Type="String" />
               <asp:Parameter Name="Filedinhkem" Type="String" />
              
           </InsertParameters>
          
      </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource_XLsp" runat="server" 
            ConnectionString="<%$ ConnectionStrings:QLMTConnectionString %>" 
            SelectCommand="SELECT [Mavipham],[TenDN], [SoQDXP], [NgayraQD], [Tenvipham], [Khoanvipham], [Dieuvipham], [Nghidinhvipham], [Ghichu], [Sotiennopphat], [Filedinhkem] FROM [Xuphatvipham]">
        </asp:SqlDataSource>
        
         <asp:SqlDataSource ID="sp_dn" runat="server" 
           ConnectionString="<%$ ConnectionStrings:QLMTConnectionString %>" 
           SelectCommand="SELECT * FROM [Doanhnghiep] where Madnghiep=@Madnghiep">
            <SelectParameters>
        <asp:QueryStringParameter Name="Madnghiep" QueryStringField="_iddn"  ConvertEmptyStringToNull="true"/>
     </SelectParameters>
         </asp:SqlDataSource>
        
               <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor1" runat="server" TextBoxStyle-Width="200px" />
       <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor2" runat="server" TextBoxStyle-Width="150px" />
       <telerik:GridDropDownListColumnEditor ID="GridDropDownColumnEditor1" runat="server" DropDownStyle-Width="110px" />
       <telerik:GridNumericColumnEditor ID="GridNumericColumnEditor1" runat="server" NumericTextBox-Width="40px" />
    </div>
    </form>
</body>
</html>
